import java.util.Scanner;

class CourseScheduler {
    private static final String[][] WEEKEND_COURSES = {
            {"语文", "英语", "数学", "物理"}, // 周六的课程
            {"天文", "地理", "历史", "生物"}  // 周日的课程
    };
    private static final String[][] COURSE_TIMES = {
            {"08:00-10:00", "10:00-12:00", "14:00-16:00", "16:00-18:00"}, // 周六的课程时间
            {"08:00-10:00", "10:00-12:00", "14:00-16:00", "16:00-18:00"}  // 周日的课程时间
    };

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入您希望安排课程的时间（格式为：星期-时间，例如：周六-08:00）：");
        String input = scanner.nextLine();

        // 解析用户输入
        String[] parts = input.split("-");
        if (parts.length != 2) {
            System.out.println("输入格式错误，请按照正确格式输入。");
            return;
        }

        String dayTime = parts[0].trim();
        String time = parts[1].trim();

        // 检查时间是否在可安排的范围内，并返回相应的课程
        if (isValidTime(dayTime, time)) {
            String courseInfo = getCourseInfo(dayTime, time);
            if (courseInfo != null) {
                System.out.println(courseInfo);
            } else {
                System.out.println("您选择的时间范围内没有课程。");
            }
        } else {
            System.out.println("此阶段内没有课程可以安排。");
        }
    }

    private static boolean isValidTime(String dayTime, String time) {
        // 检查是否是周六或周日的合法时间
        return (dayTime.equals("周六") || dayTime.equals("周日")) &&
                (time.length() == 5) && time.substring(2, 3).equals(":") &&
                ((time.startsWith("08") && time.compareTo("08:59") <= 0) ||
                        (time.startsWith("09") && time.compareTo("09:59") <= 0) ||
                        (time.startsWith("10") && time.compareTo("10:59") <= 0) ||
                        (time.startsWith("11") && time.compareTo("11:59") <= 0) ||
                        (time.startsWith("14") && time.compareTo("14:59") <= 0) ||
                        (time.startsWith("15") && time.compareTo("15:59") <= 0) ||
                        (time.startsWith("16") && time.compareTo("16:59") <= 0) ||
                        (time.startsWith("17") && time.compareTo("17:59") <= 0));
    }

    private static String getCourseInfo(String dayTime, String time) {
        int dayIndex = dayTime.equals("周六") ? 0 : 1;
        for (int i = 0; i < WEEKEND_COURSES[dayIndex].length; i++) {
            String[] times = COURSE_TIMES[dayIndex][i].split("-");
            String startTime = times[0];
            String endTime = times[1];
            if (isTimeInRange(time, startTime, endTime)) {
                return "您选择的时间可以安排的课程是：" + WEEKEND_COURSES[dayIndex][i] + "，时间段为：" + COURSE_TIMES[dayIndex][i];
            }
        }
        return null;
    }

    private static boolean isTimeInRange(String time, String startTime, String endTime) {
        // 将时间转换为分钟，方便比较
        int timeInt = Integer.parseInt(time.substring(0, 2)) * 60 + Integer.parseInt(time.substring(3, 5));
        int startInt = Integer.parseInt(startTime.substring(0, 2)) * 60 + Integer.parseInt(startTime.substring(3, 5));
        int endInt = Integer.parseInt(endTime.substring(0, 2)) * 60 + Integer.parseInt(endTime.substring(3, 5));
        return timeInt >= startInt && timeInt < endInt;
    }
}